package com.spring.aicloud.task;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.spring.aicloud.entity.User;
import com.spring.aicloud.service.IUserService;
import com.xxl.job.core.handler.annotation.XxlJob;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 存放定时任务
 */
@Component
public class TimeTask {
    @Value("${system.user.use-count}")
    private Integer useCount;
    @Resource
    private IUserService userService;
    /**
     * 重置用户使用次数定时任务
     */
    @XxlJob("resetUserUseCount")
    public void resetUserUseCount(){
        UpdateWrapper<User> wrapper = new UpdateWrapper<>();
        wrapper.set("useCount",useCount);
        if (userService.update(wrapper)){

        }
    }
}
